package com.yz.base.each;

import java.util.HashMap;

/**
 * @author yuanzheng
 * @date 2020/8/17-19:43
 */
public class MapDemo {
    public static void main(String[] args) {
        HashMap<Object, Object> map = new HashMap<>(3);
        map.put(1, "a");
        map.put(2, "b");
        map.put(3, "c");

        // 1 forEach
        map.forEach((key, value) -> {
            System.out.println(key + "-" + value);
        });

        // 2 keySet
        map.keySet().forEach(System.out::println);

        // 3 values
        map.values().forEach(System.out::println);
    }
}
